<!DOCTYPE html>
<html>
<head>
<title>账户明细</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0" /><meta content="yes" name="apple-mobile-web-app-capable" /><meta content="black" name="apple-mobile-web-app-status-bar-style" /><meta content="telephone=no" name="format-detection" />
<link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
<link href="../assets/mobile/member.css" rel="stylesheet" type="text/css" />
<script src="../assets/js/mobile/jquery190.js" type="text/javascript"></script>
<link rel="stylesheet" href="../assets/mobile/top.css">
<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<style>body{position:static;}</style>
</head>
<body>
<div class="h5-1yyg-v1" id="loadingPicBlock">

<div id="ios-top-box">
	<div id="header" class="bar bar-nav">
	<div class="titlebar">
	<a href="javascript:appClose('userbalance',api);"><i class="iconfont iconline-arrow-left"></i></a>
	<h1 class="title">账户明细</h1>
	</div>
	</div>
</div>

    <input name="loadDataType" type="hidden" id="loadDataType" value="0" />    
    <section class="clearfix g-member" style="margin-top:44px;">
	    <article class="clearfix m-round g-userMoney">
		    <a href="javascript:randomSwitchBtn('userrecharge',api);" class="z-Recharge-btn">去充值</a>可用余额<span class="orange yu">0</span>元
	    </article>
	    <article class="mt10 m-round">
		    <ul class="m-userMoneyNav">
			    <li><a id="btnConsumption" href="javascript:;"><b>消费明细</b>(消费总金额：￥<span class="xfsum">0</span>)</a><s></s></li>
			    <li><a id="btnRecharge" href="javascript:;"><b>充值明细</b>(充值总金额：￥<span class="czsum">0</span>)</a></li>
		    </ul>
		    
		    <ul id="ulConsumption" class="m-userMoneylst m-Consumption">
		    </ul>
		    <ul id="ulRechage" class="m-userMoneylst" style="display:none;">
		    </ul>
		    <div id="divLoad" class="loading"><b></b>正在加载</div>
		    <a id="btnLoadMore" class="loading" href="javascript:;" style="display:none;">点击加载更多</a>
	    </article>
    </section>
</div>
<script src="../assets/js/mobile/BottomFun.js" type="text/javascript"></script>
<script type="text/javascript">
    var userinfo = getUserinfo();
    if(!userinfo){
    	$.PageDialog.fail('请登录用户');
        apiready = function(){
        	randomSwitchBtn('login',api);
        };
    }else{
    GetJPData(config.url+'/app.php?act=userbalance',{uid:userinfo.uid},function(data){
        $('.yu').text(data['money']);
        $('.xfsum').text(data['xfsum']);
        $('.czsum').text(data['czsum']);
    });
    
    var a = function() {	 
        var l = $("#ulRechage");
        var i = $("#ulConsumption");
        var d = $("#divLoad");
        var c = $("#btnLoadMore");
        var b = $("#btnRecharge");
        var f = $("#btnConsumption");
        var u = false;
        var o = false;
        var g = 100;
        var h = null;
        var e = null;
        var m = 0;
        var p = false;
        var n = false;
        var k = false;
        var j = $("#loadDataType").val() === "1";
        var r = function() {
            var x = 0;
            var v = {
                FIdx: 0,
                EIdx: g,
                isCount: 1
            };
            var w = function() {
                return "&FIdx=" + v.FIdx + "&EIdx=" + v.EIdx + "&isCount=" + v.isCount+"&uid="+userinfo.uid;
            };
            var y = function() {
                d.show();
				 GetJPData(config.url+"/app.php?act=getUserRecharge"+w(),{},function(D) {
                    if (D.code == 0) {
                        var B = "";
                        if (v.isCount == 1) {
                            x = D.count;
                            v.isCount = 0;
                            B = '<li class="m-userMoneylst-tt"><span>充值时间</span><span>充值金额</span><span>充值渠道</span></li>';
                        }
                        var C = D.listItems;
                        var A = C.length;
                        for (var z = 0; z < A; z++) {
                            B += '<li class="' + (z + 1 == A ? "bornone": "") + '"><span>' + C[z].time + "</span><span>￥" + C[z].money + "</span><span>" + C[z].content + "</span></li>";
                        }
                        if (v.FIdx > 0) {
                            l.children("li").last().removeClass("bornone");
                        }
                        l.append(B);
                        if (v.EIdx < x) {
                            c.show();
                        } else {
                            n = true;
                            c.hide();
                        }
                    } else {
                        if (D.code == 10) {
                            location.reload();
                        } else {
                            if (v.FIdx == 0) {
                                n = true;
                                l.append(Gobal.NoneHtml);
                                c.hide();
                            }
                        }
                    }
                    d.hide();
                    u = true;
                    p = false;
                });
            };
            this.initPage = function() {
                y();
            };
            this.getNextPage = function() {
                v.FIdx += g;
                v.EIdx += g;
                y();
            };
        };
        var t = function() {
            var x = 0;
            var v = {
                FIdx: 0,
                EIdx: g,
                isCount: 1
            };
            var w = function() {
                return "&FIdx=" + v.FIdx + "&EIdx=" + v.EIdx + "&isCount=" + v.isCount+"&uid="+userinfo.uid;
            };
            var y = function() {
                d.show();				
                GetJPData(config.url+"/app.php?act=getUserConsumption"+w(),{},function(D) {
                    if (D.code == 0) {
                        var B = "";
                        if (v.isCount == 1) {
                            v.isCount = 0;
                            x = D.count;							 
                            B = '<li class="m-userMoneylst-tt"><span>消费时间</span><span>消费金额</span></li>';
                        }
                        var C = D.listItems;
                        var A = C.length;
                        for (var z = 0; z < A; z++) {
                            B += '<li class="' + (z + 1 == A ? "bornone": "") + '"><span>' + C[z].time + "</span><span>￥" + C[z].money + "</span></li>";
                        }
                        if (v.FIdx > 0) {
                            i.children("li").last().removeClass("bornone");
                        }
                        i.append(B);						 
                        if (v.EIdx < x) {
                            c.show();
                        } else {
                            k = true;
                            c.hide();
                        }
                    } else {
                        if (D.code == 10) {
                            location.reload();
                        } else {
                            if (v.FIdx == 0) {
                                i.append(Gobal.NoneHtml);
                                k = true;
                                c.hide();
                            }
                        }
                    }
                    d.hide();
                    o = true;
                    p = false;
                });
            };
            this.initPage = function() {
                y();
            };
            this.getNextPage = function() {
			  
                v.FIdx += g;
                v.EIdx += g;				 
                y();
            };
        };
        h = new r();
        e = new t();
        var q = function() {
            m = 0;
            b.removeClass("z-MoneyNav-crt02");
            f.addClass("z-MoneyNav-crt01");
            l.hide();
            i.show();
            if (!k) {
                c.show();
            } else {
                c.hide();
            }
            if (!o) {
                e.initPage();
            }
        };
        var s = function() {
            m = 1;
            b.addClass("z-MoneyNav-crt02");
            f.removeClass("z-MoneyNav-crt01");
            l.show();
            i.hide();
            if (!n) {
                c.show();
            } else {
                c.hide();
            }
            if (!u) {
                h.initPage();
            }
        };
        if (j) {
            s();
        } else {
            q();
        }
        f.click(q);
        b.click(s);
        c.click(function() {
            if (!p) {
                p = true;
                c.hide();
                if (m == 1) {
                    h.getNextPage();
                } else {
                    e.getNextPage();
                }
            }
        });
    };
a();
    }
</script>
</body>
</html>
